package demo;


/**
 * 玉米类(继承作物类)
 */
public class Corn extends Crop {
    private double harvestCost;      //收割费用
    public double getHarvestCost() {
        return harvestCost;
    }
    public void setHarvestCost(double harvestCost) {
        this.harvestCost = harvestCost;
    }


    public Corn(double harvestCost){
        super("玉米",8,3,200);  //访问父类的构造方法
        super.setStatus(Constants.GROW);
        this.harvestCost = harvestCost;
    }

    public Corn(){}
    /*
      重写父类的print方法
      */
    public void print(){
        super.print();
        System.out.println(super.getName()+"的收割费用："+this.harvestCost+"元。");

    }
    /*
   重写父类的printGrowReport方法
   */
    public void printGrowReport(int day) {
        super.printGrowReport(day);
    }
    /*
   重写父类的harvest方法
   */
    public void harvest() {
        super.harvest();
        System.out.println("使用家用收割机收割"+super.getName()+"，费用："+this.harvestCost+"元。");
    }

    @Override
    public void disinfestation() {
        System.out.println(super.getName()+"种子喷洒农药后再播种，防止地下害虫咬食，果实生长期打药1次");
    }

    //更换收割机方法
    public void  reHarvester(double newHarvestCost){
        if(this.harvestCost==newHarvestCost){
            System.out.println("当前不需要嫁接品种");
        }else {
            this.harvestCost=newHarvestCost;
            System.out.println("嫁接成功，当前的品种是"+this.harvestCost);
        }
    }
}
